home *** CD-ROM | disk | FTP | other *** search
/ TOS Silver 2000 / TOS Silver 2000.iso / programm / GNU_C++ / LIB / SRC / GEMLIB38.LZH / v_escape.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-07-10  |  12.2 KB  |  624 lines

  1. /*
  2.  * vdiesc.c
  3.  * Copyright 1991 Jens Tingleff (uunet!titan.ee.ic.ac.uk!jensting)
  4.  * Dedicated to public domain
  5.  *
  6.  * -------------------------------------
  7.  * 12.07.97 cf (felsch@tu-harburg.de)
  8.  *        modified for new control arrays
  9.  *
  10.  * 15.06.98
  11.  *        - restructured, new bindings for all functions
  12. */
  13.  
  14. #include "gem.h"
  15.  
  16.  
  17. /*
  18.  * special graphic funkcions
  19. */
  20. void v_bit_image(int handle, char *filename, int aspect, int x_scale,
  21.                         int y_scale, int h_align, int v_align,    int *pxyarray)
  22. {
  23.     short n;
  24.  
  25.     vdi_intin[0] = aspect;
  26.     vdi_intin[1] = x_scale;
  27.     vdi_intin[2] = y_scale;
  28.     vdi_intin[3] = h_align;
  29.     vdi_intin[4] = v_align;
  30.     n = vdi_str2array(filename, vdi_intin+5);
  31.     vdi_ptsin[0] = pxyarray[0];
  32.     vdi_ptsin[1] = pxyarray[1];
  33.     vdi_ptsin[2] = pxyarray[2];
  34.     vdi_ptsin[3] = pxyarray[3];
  35.     
  36.     vdi_control[0] = 5;
  37.     vdi_control[1] = 2;
  38.     vdi_control[3] = n + 5;
  39.     vdi_control[5] = 23;
  40.     vdi_control[6] = handle;
  41.     vdi(&vdi_params);
  42. }
  43.  
  44. void v_clear_disp_list(int handle)
  45. {
  46.     vdi_control[0] = 5;
  47.     vdi_control[1] = 0;
  48.     vdi_control[3] = 0;
  49.     vdi_control[5] = 22;
  50.     vdi_control[6] = handle;
  51.     vdi(&vdi_params);
  52. }
  53.  
  54. int v_copies(int handle, int count)
  55. {
  56.     vdi_intin[0] = count;
  57.     vdi_control[0] = 5;
  58.     vdi_control[1] = 0;
  59.     vdi_control[3] = 1;
  60.     vdi_control[5] = 28;
  61.     vdi_control[6] = handle;
  62.     vdi(&vdi_params);
  63.     return vdi_intout[0];
  64.  
  65. void v_dspcur(int handle, int x, int y)
  66. {
  67.     vdi_ptsin[0] = x;
  68.     vdi_ptsin[1] = y;
  69.     vdi_control[0] = 5;
  70.     vdi_control[1] = 1;
  71.     vdi_control[3] = 0;
  72.     vdi_control[5] = 18;
  73.     vdi_control[6] = handle;
  74.     vdi(&vdi_params);
  75. }
  76.  
  77. void v_form_adv(int handle)
  78. {
  79.     vdi_control[0] = 5;
  80.     vdi_control[1] = 0;
  81.     vdi_control[3] = 0;
  82.     vdi_control[5] = 20;
  83.     vdi_control[6] = handle;
  84.     vdi(&vdi_params);
  85. }
  86.  
  87. void v_hardcopy(int handle)
  88. {
  89.     vdi_control[0] = 5;
  90.     vdi_control[1] = 0;
  91.     vdi_control[3] = 0;
  92.     vdi_control[5] = 17;
  93.     vdi_control[6] = handle;
  94.     vdi(&vdi_params);
  95. }
  96.  
  97. int v_orient(int handle, int orientation)
  98. {
  99.     vdi_intin[0] = orientation;
  100.     vdi_control[0] = 5;
  101.     vdi_control[1] = 0;
  102.     vdi_control[3] = 1;
  103.     vdi_control[5] = 27;
  104.     vdi_control[6] = handle;
  105.     vdi(&vdi_params);
  106.     return vdi_intout[0];
  107.  
  108. void v_output_window(int handle, int *pxyarray)
  109. {
  110.     vdi_ptsin[0] = pxyarray[0];
  111.     vdi_ptsin[1] = pxyarray[1];
  112.     vdi_ptsin[2] = pxyarray[2];
  113.     vdi_ptsin[3] = pxyarray[3];
  114.     vdi_control[0] = 5;
  115.     vdi_control[1] = 2;
  116.     vdi_control[3] = 0;
  117.     vdi_control[5] = 21;
  118.     vdi_control[6] = handle;
  119.     vdi(&vdi_params);
  120. }
  121.  
  122. int v_page_size(int handle, int page_id)
  123. {
  124.     vdi_intin[0] = page_id;
  125.     vdi_control[0] = 5;
  126.     vdi_control[1] = 0;
  127.     vdi_control[3] = 1;
  128.     vdi_control[5] = 37;
  129.     vdi_control[6] = handle;
  130.     vdi(&vdi_params);
  131.     return vdi_intout[0]; 
  132.  
  133. void v_rmcur(int handle)
  134. {
  135.     vdi_control[0] = 5;
  136.     vdi_control[1] = 0;
  137.     vdi_control[3] = 0;
  138.     vdi_control[5] = 19;
  139.     vdi_control[6] = handle;
  140.     vdi(&vdi_params);
  141. }
  142.  
  143. void v_trays(int handle, int input, int output, int *set_input, int *set_output)
  144. {
  145.     vdi_intin[0] = input;
  146.     vdi_intin[1] = output;
  147.     vdi_control[0] = 5;
  148.     vdi_control[1] = 0;
  149.     vdi_control[3] = 2;
  150.     vdi_control[5] = 29;
  151.     vdi_control[6] = handle;
  152.     vdi(&vdi_params);
  153.     *set_input  = vdi_intout[0];
  154.     *set_output = vdi_intout[1];
  155.  
  156. int vq_calibrate (int handle, int *flag)
  157. {
  158.     vdi_control[0] = 5;
  159.     vdi_control[1] = 0;
  160.     vdi_control[3] = 1;
  161.     vdi_control[5] = 77;
  162.     vdi_control[6] = handle;
  163.     vdi(&vdi_params);
  164.     *flag = vdi_intout[0];
  165.     return vdi_control[4];
  166.  
  167. int vq_page_name(int handle, int page_id, char *page_name, long *page_width, long *page_height)
  168. {
  169.     vdi_intin[0] = page_id;
  170.     *((char **)(&vdi_intin[1])) = page_name;
  171.     vdi_control[0] = 5;
  172.     vdi_control[1] = 0;
  173.     vdi_control[3] = 3;
  174.     vdi_control[5] = 38;
  175.     vdi_control[6] = handle;
  176.     vdi(&vdi_params);
  177.     *page_width  = *((long *)(&vdi_intout[1]));
  178.     *page_height = *((long *)(&vdi_intout[3])); 
  179.     return vdi_intout[0];
  180.  
  181. void vq_scan(int handle, int *g_slice, int *g_page, int *a_slice, int *a_page, int *div_fac)
  182. {
  183.     vdi_control[0] = 5;
  184.     vdi_control[1] = 0;
  185.     vdi_control[3] = 0;
  186.     vdi_control[5] = 24;
  187.     vdi_control[6] = handle;
  188.     vdi(&vdi_params);
  189.     *g_slice = vdi_intout[0];
  190.     *g_page  = vdi_intout[1];
  191.     *a_slice = vdi_intout[2];
  192.     *a_page  = vdi_intout[3];
  193.     *div_fac = vdi_intout[4];
  194. }
  195.  
  196. int vq_tabstatus(int handle)
  197. {
  198.     vdi_control[0] = 5;
  199.     vdi_control[1] = 0;
  200.     vdi_control[3] = 0;
  201.     vdi_control[5] = 16;
  202.     vdi_control[6] = handle;
  203.     vdi(&vdi_params);
  204.     return vdi_intout[0];
  205. }
  206.  
  207. void vq_tray_names(int handle, char *input_name, char *output_name, int *input, int *output)
  208. {
  209.     *((char **)(&vdi_intin[0])) = input_name;
  210.     *((char **)(&vdi_intin[2])) = output_name;
  211.     vdi_control[0] = 5;
  212.     vdi_control[1] = 0;
  213.     vdi_control[3] = 4;
  214.     vdi_control[5] = 36;
  215.     vdi_control[6] = handle;
  216.     vdi(&vdi_params);
  217.     *input = vdi_intout[0];
  218.     *output = vdi_intout[1]; 
  219.  
  220. int vs_calibrate (int handle, int flag, int *rgb)
  221. {
  222.     *((int **)(&vdi_intin[0])) = rgb;
  223.     vdi_intin[2] = flag;
  224.     vdi_control[0] = 5;
  225.     vdi_control[1] = 0;
  226.     vdi_control[3] = 3;
  227.     vdi_control[5] = 76;
  228.     vdi_control[6] = handle;
  229.     vdi(&vdi_params);
  230.     return vdi_intout[0];
  231.  
  232. int vs_palette( int handle, int palette)
  233. {
  234.     vdi_intin[0] = palette;
  235.     vdi_control[0] = 5;
  236.     vdi_control[1] = 0;
  237.     vdi_control[3] = 1;
  238.     vdi_control[5] = 60;
  239.     vdi_control[6] = handle;
  240.     vdi(&vdi_params);
  241.     return vdi_intout[0];
  242. }
  243.  
  244.  
  245. /*
  246.  * graphic table functions
  247. */
  248. void vq_tdimensions(int handle, int *xdimension, int *ydimension)
  249. {
  250.     vdi_control[0] = 5;
  251.     vdi_control[1] = 0;
  252.     vdi_control[3] = 0;
  253.     vdi_control[5] = 84;
  254.     vdi_control[6] = handle;
  255.     vdi(&vdi_params);
  256.     *xdimension = vdi_intout[0];
  257.     *ydimension = vdi_intout[1]; 
  258.  
  259. void vt_alignment(int handle, int dx, int dy)
  260. {
  261.     vdi_intin[0] = dx;
  262.     vdi_intin[1] = dy;
  263.     vdi_control[0] = 5;
  264.     vdi_control[1] = 0;
  265.     vdi_control[3] = 2;
  266.     vdi_control[5] = 85;
  267.     vdi_control[6] = handle;
  268.     vdi(&vdi_params);
  269. }
  270.  
  271. void vt_axis(int handle, int xres, int yres, int *xset, int *yset)
  272. {
  273.     vdi_intin[0] = xres;
  274.     vdi_intin[1] = yres;
  275.     vdi_control[0] = 5;
  276.     vdi_control[1] = 0;
  277.     vdi_control[3] = 2;
  278.     vdi_control[5] = 82;
  279.     vdi_control[6] = handle;
  280.     vdi(&vdi_params);
  281.     *xset = vdi_intout[0];
  282.     *yset = vdi_intout[1];
  283. }
  284.  
  285. void vt_origin(int handle, int xorigin, int yorigin)
  286. {
  287.     vdi_intin[0] = xorigin;
  288.     vdi_intin[1] = yorigin;
  289.     vdi_control[0] = 5;
  290.     vdi_control[1] = 0;
  291.     vdi_control[3] = 2;
  292.     vdi_control[5] = 83;
  293.     vdi_control[6] = handle;
  294.     vdi(&vdi_params);
  295. }
  296.  
  297. void vt_resolution( int handle, int xres, int yres, int *xset, int *yset)
  298. {
  299.     vdi_intin[0] = xres;
  300.     vdi_intin[1] = yres;
  301.     vdi_control[0] = 5;
  302.     vdi_control[1] = 0;
  303.     vdi_control[3] = 2;
  304.     vdi_control[5] = 81;
  305.     vdi_control[6] = handle;
  306.     vdi(&vdi_params);
  307.     *xset = vdi_intout[0];
  308.     *yset = vdi_intout[1];
  309. }
  310.  
  311.  
  312. /*
  313.  * metfile functions
  314. */
  315. void v_meta_extents(int handle, int min_x, int min_y, int max_x, int max_y)
  316. {
  317.     vdi_ptsin[0] = min_x;
  318.     vdi_ptsin[1] = min_y;
  319.     vdi_ptsin[2] = max_x;
  320.     vdi_ptsin[3] = max_y;
  321.     vdi_control[0] = 5;
  322.     vdi_control[1] = 2;
  323.     vdi_control[3] = 0;
  324.     vdi_control[5] = 98;
  325.     vdi_control[6] = handle;
  326.     vdi(&vdi_params);
  327. }
  328.  
  329. void v_write_meta(int handle, int numvdi_intin, int *avdi_intin, int num_ptsin, int *a_ptsin)
  330. {
  331. #ifdef __MSHORT__
  332.     vdi_params.intin = (short *) &avdi_intin[0];
  333.     vdi_params.ptsin = (short *) &a_ptsin[0];
  334. #else
  335.     register int i;
  336.  
  337.     for(i = 0; i < numvdi_intin; i++)
  338.         vdi_intin[i] = avdi_intin[i];
  339.  
  340.     for(i = 0; i < num_ptsin; i++)
  341.         vdi_ptsin[i] = a_ptsin[i];
  342. #endif
  343.     vdi_control[0] = 5;
  344.     vdi_control[1] = num_ptsin;
  345.     vdi_control[3] = numvdi_intin;
  346.     vdi_control[5] = 99;
  347.     vdi_control[6] = handle;
  348.     vdi(&vdi_params);
  349.  
  350. #ifdef __MSHORT__
  351.     vdi_params.intin = &vdi_intin[0]; 
  352.     vdi_params.ptsin = &vdi_ptsin[0]; 
  353. #endif
  354. }
  355.  
  356. void vm_coords(int handle, int llx, int lly, int urx, int ury)
  357. {
  358.     vdi_intin[0] = 1;
  359.     vdi_intin[1] = llx;
  360.     vdi_intin[2] = lly;
  361.     vdi_intin[3] = urx;
  362.     vdi_intin[4] = ury;
  363.     vdi_control[0] = 5;
  364.     vdi_control[1] = 0;
  365.     vdi_control[3] = 5;
  366.     vdi_control[5] = 99;
  367.     vdi_control[6] = handle;
  368.     vdi(&vdi_params);
  369. }
  370.  
  371. void vm_filename(int handle, char *filename)
  372. {
  373.     short n;
  374.  
  375.      n = vdi_str2array(filename, vdi_intin);
  376.     vdi_control[0] = 5;
  377.     vdi_control[1] = 0;
  378.     vdi_control[3] = n;
  379.     vdi_control[5] = 100;
  380.     vdi_control[6] = handle;
  381.     vdi(&vdi_params);
  382.  
  383. }
  384.  
  385. void vm_pagesize(int handle, int pgwidth, int pgheight)
  386. {
  387.     vdi_intin[0] = 0;
  388.     vdi_intin[1] = pgwidth;
  389.     vdi_intin[2] = pgheight;
  390.     vdi_control[0] = 5;
  391.     vdi_control[1] = 0;
  392.     vdi_control[3] = 3;
  393.     vdi_control[5] = 99;
  394.     vdi_control[6] = handle;
  395.     vdi(&vdi_params);
  396. }
  397.  
  398.  
  399. /*
  400.  * polaroid functions - not complete implemented!
  401. */
  402. void vsc_expose(int handle, int state)
  403. {
  404.     vdi_intin[0] = state;
  405.     vdi_control[0] = 5;
  406.     vdi_control[1] = 0;
  407.     vdi_control[3] = 1;
  408.     vdi_control[5] = 93;
  409.     vdi_control[6] = handle;
  410.     vdi(&vdi_params);
  411. }
  412.  
  413. void vsp_film(int handle, int index, int lightness)
  414. {
  415.     vdi_intin[0] = index;
  416.     vdi_intin[1] = lightness;
  417.     vdi_control[0] = 5;
  418.     vdi_control[1] = 0;
  419.     vdi_control[3] = 2;
  420.     vdi_control[5] = 91;
  421.     vdi_control[6] = handle;
  422.     vdi(&vdi_params);
  423. }
  424.  
  425.  
  426. /*
  427.  * special functions
  428. */
  429. void v_escape2000(int handle, int times)
  430. {
  431.     vdi_intin[0] = times;
  432.     vdi_control[0] = 5;
  433.     vdi_control[1] = 0;
  434.     vdi_control[3] = 1;
  435.     vdi_control[5] = 2000;
  436.     vdi_control[6] = handle;
  437.     vdi(&vdi_params);
  438. }
  439.  
  440.  
  441. /*
  442.  * text functions
  443. */
  444. void v_alpha_text(int handle, char *str)
  445. {
  446.     short    n;
  447.     
  448.     n = vdi_str2array(str, vdi_intin);
  449.     vdi_control[0] = 5;
  450.     vdi_control[1] = 0;
  451.     vdi_control[3] = n;
  452.     vdi_control[5] = 25;
  453.     vdi_control[6] = handle;
  454.     vdi(&vdi_params);
  455. }
  456.  
  457. void v_curdown(int handle)
  458. {
  459.     vdi_control[0] = 5;
  460.     vdi_control[1] = 0;
  461.     vdi_control[3] = 0;
  462.     vdi_control[5] = 5;
  463.     vdi_control[6] = handle;
  464.     vdi(&vdi_params);
  465. }
  466.  
  467. void v_curhome(int handle)
  468. {
  469.     vdi_control[0] = 5;
  470.     vdi_control[1] = 0;
  471.     vdi_control[3] = 0;
  472.     vdi_control[5] = 8;
  473.     vdi_control[6] = handle;
  474.     vdi(&vdi_params);
  475. }
  476.  
  477. void v_curleft(int handle)
  478. {
  479.     vdi_control[0] = 5;
  480.     vdi_control[1] = 0;
  481.     vdi_control[3] = 0;
  482.     vdi_control[5] = 7;
  483.     vdi_control[6] = handle;
  484.     vdi(&vdi_params);
  485. }
  486.  
  487. void v_curright(int handle)
  488. {
  489.     vdi_control[0] = 5;
  490.     vdi_control[1] = 0;
  491.     vdi_control[3] = 0;
  492.     vdi_control[5] = 6;
  493.     vdi_control[6] = handle;
  494.     vdi(&vdi_params);
  495. }
  496.  
  497. void v_curtext(int handle, char *str)
  498. {
  499.     short    i;
  500.     
  501.     i = vdi_str2array(str, vdi_intin);
  502.     vdi_control[0] = 5;
  503.     vdi_control[1] = 0;
  504.     vdi_control[3] = i;
  505.     vdi_control[5] = 12;
  506.     vdi_control[6] = handle;
  507.     vdi(&vdi_params);
  508. }
  509.  
  510. void v_curup(int handle)
  511. {
  512.     vdi_control[0] = 5;
  513.     vdi_control[1] = 0;
  514.     vdi_control[3] = 0;
  515.     vdi_control[5] = 4;
  516.     vdi_control[6] = handle;
  517.     vdi(&vdi_params);
  518. }
  519.  
  520. void v_eeol(int handle)
  521. {
  522.     vdi_control[0] = 5;
  523.     vdi_control[1] = 0;
  524.     vdi_control[3] = 0;
  525.     vdi_control[5] = 10;
  526.     vdi_control[6] = handle;
  527.     vdi(&vdi_params);
  528. }
  529.  
  530. void v_eeos(int handle)
  531. {
  532.     vdi_control[0] = 5;
  533.     vdi_control[1] = 0;
  534.     vdi_control[3] = 0;
  535.     vdi_control[5] = 9;
  536.     vdi_control[6] = handle;
  537.     vdi(&vdi_params);
  538. }
  539.  
  540. void v_enter_cur(int handle)
  541. {
  542.     vdi_control[0] = 5;
  543.     vdi_control[1] = 0;
  544.     vdi_control[3] = 0;
  545.     vdi_control[5] = 3;
  546.     vdi_control[6] = handle;
  547.     vdi(&vdi_params);
  548. }
  549.  
  550. void v_exit_cur(int handle)
  551. {
  552.     vdi_control[0] = 5;
  553.     vdi_control[1] = 0;
  554.     vdi_control[3] = 0;
  555.     vdi_control[5] = 2;
  556.     vdi_control[6] = handle;
  557.     vdi(&vdi_params);
  558. }
  559.  
  560. void v_rvoff(int handle)
  561. {
  562.     vdi_control[0] = 5;
  563.     vdi_control[1] = 0;
  564.     vdi_control[3] = 0;
  565.     vdi_control[5] = 14;
  566.     vdi_control[6] = handle;
  567.     vdi(&vdi_params);
  568. }
  569.  
  570. void v_rvon(int handle)
  571. {
  572.     vdi_control[0] = 5;
  573.     vdi_control[1] = 0;
  574.     vdi_control[3] = 0;
  575.     vdi_control[5] = 13;
  576.     vdi_control[6] = handle;
  577.     vdi(&vdi_params);
  578. }
  579.  
  580. void vq_chcells(int handle, int *n_rows, int *n_cols)
  581. {
  582.     vdi_control[0] = 5;
  583.     vdi_control[1] = 0;
  584.     vdi_control[3] = 0;
  585.     vdi_control[5] = 1;
  586.     vdi_control[6] = handle;
  587.     vdi(&vdi_params);
  588.     *n_rows = vdi_intout[0];
  589.     *n_cols = vdi_intout[1];
  590. }
  591.  
  592. void vq_curaddress(int handle, int *cur_row, int *cur_col)
  593. {
  594.     vdi_control[0] = 5;
  595.     vdi_control[1] = 0;
  596.     vdi_control[3] = 0;
  597.     vdi_control[5] = 15;
  598.     vdi_control[6] = handle;
  599.     vdi(&vdi_params);
  600.     *cur_row = vdi_intout[0];
  601.     *cur_col = vdi_intout[1];
  602. }
  603.  
  604. void vs_curaddress(int handle, int row, int col)
  605. {
  606.     vdi_intin[0] = row;
  607.     vdi_intin[1] = col;
  608.     vdi_control[0] = 5;
  609.     vdi_control[1] = 0;
  610.     vdi_control[3] = 2;
  611.     vdi_control[5] = 11;
  612.     vdi_control[6] = handle;
  613.     vdi(&vdi_params);
  614. }
  615.